home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Eudora 1.3.1 / source / lmgr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-16  |  1.7 KB  |  56 lines  |  [TEXT/MPS ]

  1. #define FILE_NUM 49
  2. /* Copyright (c) 1990-1992 by the University of Illinois Board of Trustees */
  3. /* Copyright (c) 1992 by Qualcomm, Inc. */
  4. #pragma load EUDORA_LOAD
  5. #pragma segment LMgr
  6.  
  7. /************************************************************************
  8.  * FirstSelected - find the first selection (if any)
  9.  ************************************************************************/
  10. Boolean FirstSelected(Cell *c,ListHandle list)
  11. {
  12.     c->h = c->v = 0;
  13.     return(LGetSelect(True,c,list));
  14. }
  15.  
  16. /************************************************************************
  17.  * Next1Selected - get the index (plus 1) of the next selected cell
  18.  *  in a 1-dimensional list.
  19.  *  returns 0 if no (more) cells selected
  20.  ************************************************************************/
  21. short Next1Selected(short thisOne,ListHandle list)
  22. {
  23.     Point c;
  24.     c.h = 0;
  25.     c.v = thisOne;
  26.     if (LGetSelect(True,&c,list)) return(c.v+1);
  27.     else return(0);
  28. }
  29.  
  30. /************************************************************************
  31.  * InWhich1Cell - over which cell (in a 1dim list) is the point?
  32.  ************************************************************************/
  33. short InWhich1Cell(Point mouse,ListHandle list)
  34. {
  35.     Rect rView = (*list)->rView;
  36.     short cellHi = (*list)->cellSize.v;
  37.     short scroll = (*list)->visible.top;
  38.     short cell;
  39.     
  40.     if (!PtInRect(mouse,&rView)) return(0);
  41.     
  42.     cell = scroll + (mouse.v-rView.top)/cellHi + 1;
  43.     return(cell);
  44. }
  45.  
  46.  
  47. /************************************************************************
  48.  * Cell1Selected - is a cell in a 1dim list selected?
  49.  ************************************************************************/
  50. Boolean Cell1Selected(short which,ListHandle list)
  51. {
  52.     Point pt;
  53.     
  54.     pt.h = 0; pt.v = which-1;
  55.     return(LGetSelect(False,&pt,list));
  56. }